{% extends 'base.html' %}

{% load i18n %}
{% load custom_url_tags %}
{% load custom_translation %}

{% block title %}
{% trans "KataGo - Contributors" %}
{% endblock %}

{% block content %}

<h1 class="title">{% trans "Contributors" %}</h1>

{% if has_multiple_runs %}
{% url 'runs' as runs_url %}
{% blocktrans %}
Recent and total contributions to KataGo distributed training, summed
across <strong>all</strong> runs. For contributions and other stats for individual
runs, see <a href="{{runs_url}}">here</a>.
{% endblocktrans %}
{% endif %}


{% if top_day_user_list|length > 0 %}
<h5 class="is-size-5 mt-4"> {% trans "Top contributors for KataGo distributed training in the last 24h:" %} </h5>

<table class="table mt-2">
  <tr>
    <th> {% trans "User" %} </th>
    <th class="has-text-right"> {% trans "Training Rows" %} </th>
    <th class="has-text-right"> {% trans "Training Games" %} </th>
    <th class="has-text-right"> {% trans "Rating Games" %} </th>
  </tr>
  {% for user in top_day_user_list %}
  <tr>
    <td> {{ user.username }} </td>
    <td class="has-text-right"> {{ user.total_num_training_rows|as_n_training_rows_str }} </td>
    <td class="has-text-right"> <a href="{% training_games_list_by_user user.username %}"> {{ user.total_num_training_games|as_n_training_games_str }}</a> </td>
    <td class="has-text-right"> <a href="{% rating_games_list_by_user user.username %}"> {{ user.total_num_rating_games|as_n_rating_games_str }}</a> </td>
  </tr>
  {% endfor %}
</table>
{% endif %}

{% if top_recent_user_list|length > 0 %}
<h5 class="is-size-5 mt-4"> {% trans "Top contributors for KataGo distributed training in the last week:" %} </h5>

<table class="table mt-2">
  <tr>
    <th> {% trans "User" %} </th>
    <th class="has-text-right"> {% trans "Training Rows" %} </th>
    <th class="has-text-right"> {% trans "Training Games" %} </th>
    <th class="has-text-right"> {% trans "Rating Games" %} </th>
  </tr>
  {% for user in top_recent_user_list %}
  <tr>
    <td> {{ user.username }} </td>
    <td class="has-text-right"> {{ user.total_num_training_rows|as_n_training_rows_str }} </td>
    <td class="has-text-right"> <a href="{% training_games_list_by_user user.username %}"> {{ user.total_num_training_games|as_n_training_games_str }}</a> </td>
    <td class="has-text-right"> <a href="{% rating_games_list_by_user user.username %}"> {{ user.total_num_rating_games|as_n_rating_games_str }}</a> </td>
  </tr>
  {% endfor %}
</table>
{% endif %}

<h5 class="is-size-5 mt-4"> {% trans "All contributors for KataGo distributed training across all time:" %} </h5>

<table class="table mt-2">
  <tr>
    <th> {% trans "User" %} </th>
    <th class="has-text-right"> {% trans "Training Rows" %} </th>
    <th class="has-text-right"> {% trans "Training Games" %} </th>
    <th class="has-text-right"> {% trans "Rating Games" %} </th>
  </tr>
  {% for user in all_time_user_list %}
  <tr>
    <td> {{ user.username }} </td>
    <td class="has-text-right"> {{ user.total_num_training_rows|as_n_training_rows_str }} </td>
    <td class="has-text-right"> <a href="{% training_games_list_by_user user.username %}"> {{ user.total_num_training_games|as_n_training_games_str }}</a> </td>
    <td class="has-text-right"> <a href="{% rating_games_list_by_user user.username %}"> {{ user.total_num_rating_games|as_n_rating_games_str }}</a> </td>
  </tr>
  {% endfor %}
</table>

{% endblock content %}
